/*
 * lcd.h
 */
#ifndef LCD_H
#define LCD_H

#include "stdint.h"
#include "led.h"
#include "rtos.h"

struct _lcd_t;

typedef struct
{
    void (*write_cmd)(void *handle, uint8_t cmd);
    void (*write_data8)(void *handle, uint8_t data);
    void (*write_data16)(void *handle, uint16_t data2);
    void (*write_data_dma)(void *handle, const uint8_t *data, uint16_t len);
    void (*write_data_dma_end)(void *handle);
    void (*reset)(void *handle, uint16_t ms1, uint16_t ms2);
}lcd_bus_t;

typedef struct
{
    void (*rotation)(struct _lcd_t *, uint16_t);
    void (*draw_rect)(struct _lcd_t *, uint16_t, uint16_t, uint16_t, uint16_t, const uint8_t *);
    void (*cmd)(struct _lcd_t *, uint8_t);
    void (*draw_end)(struct _lcd_t *);
}lcd_dev_t;

typedef union
{
    struct
    {
        uint8_t dis_on;
        uint8_t dis_off;
        uint8_t sleep_in;
        uint8_t sleep_out;
    };
    uint8_t g[4];
}lcd_cmd_group_t;

typedef struct _lcd_t
{
    uint32_t x_size;
    uint32_t y_size;
    uint16_t rst_time1;
    uint16_t rst_time2;
    lcd_cmd_group_t cmd_group;
    //led_t backlight;

    void *dev_handle;
    lcd_dev_t *dev;
}lcd_base_t;

#endif /* LCD_H */
